<template>
  <div>
      <h1>登录页面</h1>
      用户名: <input type="text" v-model="username">
      密码: <input type="password" v-model="password">
      <input type="button" value="登录" @click="login">
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
            username:'',
            password:''
        }
    },
    methods: {
        login(){
            let data =new FormData()
            data.append("username",this.username)
            data.append('password',this.password)
            axios.post('/api/login',data).then(resp=>{
                console.log(resp.data)      
            }).catch(error=>{
                console.log(error)
            })
        }
    },
}
</script>

<style>

</style>